
import 'package:flutter/material.dart';
import 'package:reabampos/src/reabam/operation/rb_config.dart';
import 'package:reabampos/src/reabam/operation/rb_enum.dart';
import 'package:reabampos/src/reabam/utils/rb_widget_ss.dart';
import 'package:xsdk_flutter/xsdk/xsdk_flutter_package.dart';

/*
设备品牌
 */
class SelectDevicePinaiStatePage extends XPageListViewState{

  String tag;

  SelectDevicePinaiStatePage({
    required this.tag,
  });

  @override
  Widget getListItemWidget(listItem, int removeUsePosition) {
    return XWidgetUtils.getWidgetGestureDetector(
        child: XWidgetUtils.getXLayoutRoundedRect(
            margin: XWidgetUtils.getEdgeInsets(XTempData.defaultPageMarginLeft, 10, XTempData.defaultPageMarginRight, 0),
            alignment: Alignment.centerLeft,
            height: XTempData.defaultBarHeight,
            child:XWidgetUtils.getWidgetText(
                '$listItem',
                style: XStyleUtils.getTextStyle(
                  fontSize: XTempData.defaultTextFontSize,
                  color: XColorUtils.color333333
                ),
                padding: XWidgetUtils.getEdgeInsets(XTempData.defaultLeftRightWidgetMarginLeft, 0, 0, 0)
            )
        ),
        onTap: (){
          finishPage(result: listItem);
        }
    );
  }

  @override
  void onStart() {

    if(RBConfigs.versionType==VersionType.officialSelfServiceVersion
        || RBConfigs.versionType==VersionType.testSelfServiceVersion
    ){
      //自助收银
      setXTopBarWidget(
          height: null,
          child: RBWidgets_SelfService.getTitleBarWidget(
            this,
            title: '选择品牌',
          )
      );

    }else{
      //HD h5
      setXTitle(titleText: '选择品牌',
        titleBarHeight: 50,
        isShowLeftWidget: false,);
      setXLeftFixSpace(width:458);
    }

  }

  @override
  Future<void> updateData({int pageIndex = 1}) async {
    setState(() {
      widget.listData.clear();
      if('网络打印机'==tag){
        widget.listData.add('佳博');
        widget.listData.add('芯烨');
        widget.listData.add('其他');
      }else if('云打印机'==tag){
        widget.listData.add('快麦');
      }else if('电子秤'==tag){
        widget.listData.add('大华');
        widget.listData.add('顶尖');
      }
    });

  }




}